﻿package cn.poco.pepsi.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.TextView;
import cn.poco.pepsi.R;
import cn.poco.pepsi.bean.Circle;

public class TabSearchAdapter extends BaseAdapter {
	
	//private final static String TAG = "TabSearchAdapter";
	private List<Circle> circles;
	private LayoutInflater myinflater;
	
	public TabSearchAdapter(Context context,List<Circle> circles,String citycode){
		this.circles = circles;
		this.myinflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return circles.size();
	}

	@Override
	public Object getItem(int position) {
		return circles.get(position);
	}

	@Override
	public long getItemId(int position) {
		return Long.parseLong(circles.get(position).getKey());
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolderItem holder  = new ViewHolderItem();
		convertView = myinflater.inflate(R.layout.main_tab_search_item, null);
		holder.info = (TextView) convertView.findViewById(R.id.textview);
		holder.info.setText(circles.get(position).getName());
		if(circles.get(position).getName().equals("更多")){
			holder.other = (FrameLayout)convertView.findViewById(R.id.other);
			holder.other.setVisibility(View.VISIBLE);
		}
		return convertView;
		
	}
	public final class ViewHolderItem{
		 public TextView info;
		 public FrameLayout other;
		}
	public final class ViewHolderHead{
		 public TextView info;
		}


}
